import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.Enumeration;

public class ConfigTestServlet extends HttpServlet
{
	public void service(HttpServletRequest request,
		HttpServletResponse response) throws ServletException,
		IOException
	{
		response.setContentType("text/html;charset=GB2312");
		PrintWriter out = response.getWriter();
		out.println("<html>");
		out.println("Servlet的名称为：" + this.getServletName() + "<br />");
		Enumeration e = getInitParameterNames();
		while (e.hasMoreElements())
		{
			String key = (String)e.nextElement();
			String value = getInitParameter(key);
			out.println("&nbsp;&nbsp;" + key + "=" + value + "<br />");
		}
		ServletContext context = getServletContext();
		String path = context.getRealPath("/");
		out.println("当前Web应用程序的本地目录为：" + path + "<br />");
		out.println("</html>");
	}
}
